package day20;

import java.io.*;

/**
 * @author ZJX
 * @version 1.0
 * @descption
 * @since 2025/10/29 21:35
 */
public class Day17 {
    //    字符串转整数
    public int myAtoi(String s) {
        int i = 0;
        int n = s.length();
        // 跳过空格
        while (i < n && s.charAt(i) == ' ') {
            i++;
        }

        // 判断正负
        int sign = 1;
        if (i < n && s.charAt(i) == '-') {
            sign = -1;
            i++;
        } else if (i < n && s.charAt(i) == '+') {
            i++;
        }
        int result = 0;
        while (i < n && Character.isDigit(s.charAt(i))) {
            int digit = s.charAt(i) - '0';
            if (result > (Integer.MAX_VALUE - digit) / 10) {
                return sign == 1 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
            }
            result = result * 10 + digit;
            i++;
        }
        return result * sign;
    }


//    public static void main(String[] args) throws IOException {
//       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        PrintWriter out = new PrintWriter(System.out);
//        String s = br.readLine();
//        StringBuilder sb = new StringBuilder();
//        for (int i = 0; i < s.length(); i++) {
//            char c = s.charAt(i);
//            if (c % 2 == 0){
//                sb.append(0);
//            } else {
//                sb.append(1);
//            }
//        }
//        out.println(Integer.parseInt(sb.toString()));
//        out.close();
//    }

//    public static void main(String[] args) throws IOException {
//        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//        PrintWriter out = new PrintWriter(System.out);
//        in.nextToken();
//        int n = (int) in.nval;
//        in.nextToken();
//        int m = (int) in.nval;
//
//        long[][] grid = new long[n][m];
//        long[] rowSum = new long[n];
//        long[] colSum = new long[m];
//
//        // 读取网格并计算行和
//        for (int i = 0; i < n; i++) {
//            long sum = 0;
//            for (int j = 0; j < m; j++) {
//                in.nextToken();
//                grid[i][j] = (long) in.nval; // 用long防止溢出
//                sum += grid[i][j];
//            }
//            rowSum[i] = sum;
//        }
//

    /// /        计算每一列的和
//        for (int j = 0; j < m; j++) {
//            long sum = 0;
//            for (int i = 0; i < n; i++) {
//                sum += grid[i][j];
//            }
//            colSum[j] = sum;
//        }
//        for (int i = 0; i < n; i++) {
//            for (int j = 0; j < m; j++) {
//                long score = rowSum[i] + colSum[j] - grid[i][j];
//                out.print(score + " ");
//            }
//            out.println();
//        }
//        out.close();
//    }
    public static void main(String[] args) throws IOException {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(System.out);

        // 读取输入
        in.nextToken();
        int n = (int) in.nval; // 有效期总天数
        in.nextToken();
        int k = (int) in.nval; // 效果持续天数
        long[] happy = new long[n]; // 快乐值数组，用long防止溢出
        long[] shy = new long[n];   // 羞耻度数组，用long防止溢出

        for (int i = 0; i < n; i++) {
            in.nextToken();
            happy[i] = (long) in.nval;
        }
        for (int i = 0; i < n; i++) {
            in.nextToken();
            shy[i] = (long) in.nval;
        }

        // 初始化第一个窗口
        long curHappy = 0;
        long curShy = 0;
        for (int i = 0; i < k; i++) {
            curHappy += happy[i];
            curShy += shy[i];
        }
        long MaxHappy = curHappy;
        long MinShy = curShy;
        int bestDay = 1;
        for (int i = 0; i < n - k; i++) {
            curHappy = curHappy - happy[i] + happy[i + k];
            curShy = curShy - shy[i] + shy[i + k];
            if (curHappy > MaxHappy) {
                MaxHappy = curHappy;
                MinShy = curShy;
                bestDay = i + 2;
            } else if (curHappy == MaxHappy && curShy < MinShy) {
                MinShy = curShy;
                bestDay = i + 2;
            }
        }
        out.println(bestDay);
        out.close();
    }
}

